package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * Created by oyhk on 16/7/15.
 */
@Entity
@Table(name = "category")
@DynamicInsert
@DynamicUpdate
public class Category extends IDEntityMall {

    @Column(columnDefinition = "varchar(100) comment '名称'")
    private String name;
    // 之前设计数据库的打错单词的字段名
    @Column(columnDefinition = "varchar(1000) comment '图标Url'", name = "iconUrl")
    private String iconUrl;
    @Column(columnDefinition = "bit comment '是否可见'")
    private Boolean visible = true;
    @Column(columnDefinition = "int comment '显示顺序'")
    private Integer displayOrderId;
    @Column(columnDefinition = "varchar(100) comment '描述'")
    private String note;
    @Column(columnDefinition = "bigint comment '平台id'")
    private Long mallId;
    @Column(columnDefinition = "bigint comment '父品类'")
    private Long parentId;

    public static final String ATTR_THIS = "category";


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIconUrl() {
        return iconUrl;
    }

    public void setIconUrl(String iconUrl) {
        this.iconUrl = iconUrl;
    }

    public Boolean getVisible() {
        return visible;
    }

    public void setVisible(Boolean visible) {
        this.visible = visible;
    }

    public Integer getDisplayOrderId() {
        return displayOrderId;
    }

    public void setDisplayOrderId(Integer displayOrderId) {
        this.displayOrderId = displayOrderId;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public Long getMallId() {
        return mallId;
    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    @Override
    public String toString() {
        return "Category{" +
                "name='" + name + '\'' +
                ", iconUrl='" + iconUrl + '\'' +
                ", visible=" + visible +
                ", displayOrderId=" + displayOrderId +
                ", note='" + note + '\'' +
                ", mallId=" + mallId +
                ", parentId=" + parentId +
                '}';
    }
}
